﻿<%@page import="cn.jdy.common.constant.GlobalConstant"%>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="jdy" uri="http://www.qwe.com.cn/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>康养旅居网</title>
          <jsp:include page="../common/common.jsp"/>
      <link rel="stylesheet" href="${path}/css/sign.css">
</head>
<body>
    <div class="signtitle">
        <h3></h3>
    </div>

    <div class="box setting">
              	<form id="frm_login" method="post" action="${path}/member/selfsave">

        <ul>
            <li>
                原密码：<input type="password" name="password" id="password" placeholder="请填写您的登录密码">
            </li>
            <li>
                新密码：<input type="password" name="" id="password1" placeholder="请填写您的新密码">
            </li>
            <li>
                确认密码：<input type="password" name="passwdNew" id="password2" placeholder="重复输入您的新密码">
            </li>
        </ul>
        <p class="forget "><!--  <a href="">忘记登录密码?</a>--></p>
        <div class="clearfloat"></div>        </form>
        <button class="signbutton loginout"  onclick="svare()">立即修改</button>
    
    </div>
    <script src="${path}/js/jquery-3.2.1.min.js"></script>
</body>
<script>
					function valPassword(){
						 var value = $("#password").val();
						 if(value=='' || value == null){
								layer.open({ content:"请输入密码",skin: 'msg' ,time: 2 });//2秒后自动关闭
							 return false;
						 }
						 return true;
					}
					function valPassword1(){
						 var value = $("#password1").val();
						 if(value=='' || value == null){
								layer.open({ content:"请输入新密码",skin: 'msg' ,time: 2 });//2秒后自动关闭
							 return false;
						 }
							 return true;
						
					
					}
					
					function valPassword2(){
						 var value = $("#password2").val();
						 if(value=='' || value == null){
								layer.open({ content:"请从新输入新密码",skin: 'msg' ,time: 2 });//2秒后自动关闭
							 return false;
						 }else{
							 var value1 = $("#password1").val();
							 if(value==value1){
								 return true;
							 }else{
									layer.open({ content:"两次密码不一样",skin: 'msg' ,time: 2 });//2秒后自动关闭
								 return false;
							 }
						 }
				
					}
					
					function svare(){
						if(valPassword()&&valPassword1()&&valPassword2()){
									   $.ajax({
								            //几个参数需要注意一下
								                type: "POST",//方法类型
								                dataType: "json",//预期服务器返回的数据类型
								                url: "${path}/member/selfsave" ,//url
								                data: $('#frm_login').serialize(),
								                success: function (result) {
								                    if (result.statusCode == 200) {
															location.href="${path}/member";												
								                    }else{
														layer.open({ content:result.info ,skin: 'msg' ,time: 2 });//2秒后自动关闭

								                    }
								                    ;
								                },
								                error : function() {
								                    alert("异常！");
								                }
								            });
						}
					}
					
				 
</script>
</html>